package com.zoe.onelink.logging.biz.persistent.impl;

import com.alibaba.fastjson.JSON;
import com.zoe.onelink.logging.biz.aspect.MethodInvokeResult;
import com.zoe.onelink.logging.biz.entity.BizLogInfo;
import com.zoe.onelink.logging.biz.persistent.IBizLogPersistent;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2021</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2021-10-13
 */
@Slf4j(topic = "bizLog")
public class BizLogMessageSlf4jPersistent implements IBizLogPersistent {

    @Override
    public void persist(BizLogInfo bizLogInfo, MethodInvokeResult methodInvokeResult) {
        if (methodInvokeResult.getThrowable() == null) {
            log.info(bizLogInfo.getMessage());
        } else {
            log.error(bizLogInfo.getMessage());
        }
    }

}
